

    <link rel="stylesheet" type="text/css" href="/static/index/css/pages-getOrderInfo.css" />

	<script type="text/javascript" src="/static/index/js/pages/getOrderInfo.js"></script>

	<!--主内容-->
	<div class="cart py-container">
		<div class="checkout py-container">
			<div class="checkout-tit">
				<h4 class="tit-txt">填写并核对订单信息</h4>
			</div>
			<div class="checkout-steps">
				<!--收件人信息-->
				<div class="step-tit">
					<h5>收件人信息<span><a data-toggle="modal" data-target=".edit" data-keyboard="false" class="newadd">新增收货地址</a></span></h5>
				</div>
				<div class="step-cont">
					<div class="addressInfo">
						<ul class="addr-detail">
							{foreach $address as $k=>$v}
								{if(empty($v))}
									<p>您还没有添加地址请先添加地址</p>
								{else /}
									<li class="addr-item" addres_ids = "{$v.id}">
										<div class="con name"><a href="javascript:;" ><em>{$v.consignee}</em><span title="点击取消选择">&nbsp;</span></a></div>
										<div class="con address">
											<span class="consignee_name">{$v.consignee}</span>
											<span class="consignee_address">{$v.address}</span>
											<span class="consignee_phone">{$v.phone}</span>
											{if $v.check == 1}
												<span class="base">默认地址</span>
											{else /}
												<span></span>
											{/if}
											<span class="edittext" >
<!--												<a class="edit_address" data-toggle="modal" data-target=".edit" data-keyboard="false" >编辑</a>&nbsp;&nbsp;-->
												<a class="delete_address" >删除</a>
											</span>
										</div>
										<div class="clearfix"></div>
									</li>
								{/if}
							{/foreach}
						</ul>
						<!--添加地址-->
                          <div  tabindex="-1" role="dialog" data-hasfoot="false" class="sui-modal hide fade edit">
						  <div class="modal-dialog">
						    <div class="modal-content">
						      <div class="modal-header">
						        <button type="button" data-dismiss="modal" aria-hidden="true" class="sui-close">×</button>
						        <h4 id="myModalLabel" class="modal-title">添加收货地址</h4>
						      </div>
						      <div class="modal-body">
						      	<form action="{:url('index/order/address')}" method="post" class="sui-form form-horizontal">
									<input type="hidden" name="cart_ids" value="{$Think.get.cart_ids}">
						      		 <div class="control-group">
									    <label class="control-label">收货人：</label>
									    <div class="controls">
									      	<input type="text" name="consignee" class="input-medium">
											<span class="error" style="color:#ff0000;"></span>
									    </div>
									  </div>
									   <div class="control-group">
									    <label class="control-label">详细地址：</label>
									    <div class="controls">
									      <input type="text" name="address" class="input-large">
											<span class="error" style="color:#ff0000;"></span>
										</div>
									  </div>
									   <div class="control-group">
									    <label class="control-label">联系电话：</label>
									    <div class="controls">
									      <input type="text" name="phone" maxlength="11" class="input-medium">
											<span class="error" style="color:#ff0000;"></span>
										</div>
									  </div>
									   <div class="control-group">
									    <label class="control-label">默认地址：</label>
									    <div class="controls">
									      <input type="checkbox" class="input-medium" name="check" value="1">
									    </div>
									   </div>
									<span style="color:#ff0000;">温馨提醒：请保持信息的准确性</span>
								</form>
						      </div>
						      <div class="modal-footer">
						        <button type="button" class="sui-btn btn-primary btn-large">确定</button>
						        <button type="button" data-dismiss="modal" class="sui-btn btn-default btn-large">取消</button>
						      </div>
						    </div>
						  </div>
						</div>
						 <!--确认地址-->
					</div>
					<!--<div class="hr"></div>
					<div class="recommendAddr">
						<ul class="addr-detail">
							<li class="addr-item">
								<div class="con name"><a href="javascript:;" class="selected">匹配自提点<span title="点击取消选择">&nbsp;</a></div>
								<div class="con address">时代思远书店 中关村软件园9号楼时代思远书店</div>
							</li>
						</ul>
					</div>-->
				</div>
				<div class="hr"></div>
				<!--支付和送货-->
				<div class="payshipInfo">
					<div class="step-tit">
						<h5>支付方式</h5>
					</div>
					<div class="step-cont">
						<ul class="payType">
							{foreach $pay_type as $k=>$v}
								<li class="{if $k == 'alipay'}selected{/if}" pay_type="{$k}">{$v}<span title="点击取消选择"></span></li>
							{/foreach}
						</ul>
					</div>
					<div class="hr"></div>
					<div class="step-tit">
						<h5>送货清单</h5>
					</div>
					<div class="step-cont">
						<ul class="send-detail">
							<li>
								<!--<div class="sendType">
									<span>配送方式：</span>
									<ul>
										<li>
											<div class="con express">天天快递</div>
											<div class="con delivery">配送时间：预计8月10日（周三）09:00-15:00送达</div>
										</li>
									</ul>
								</div>-->
								<div class="sendGoods">
									<span>商品清单：</span>
										{foreach $goods as $v}
											<ul class="yui3-g">
												<li class="yui3-u-1-6" style="margin-right:5px;">
													<span ><img src="{$v.goods_logo}" /></span>
												</li>
												<li class="yui3-u-7-12">
													<div class="desc">{$v.goods_name}</div>
													<div class="seven">7天无理由退货</div>
												</li>
												<li class="yui3-u-1-12">
													<div class="price">￥{$v.goods_price}</div>
												</li>
												<li class="yui3-u-1-12">
													<div class="num">X&nbsp;{$v.cart_number}</div>
												</li>
												<li class="yui3-u-1-12">
													<div class="exit">有货</div>
												</li>
											</ul>
										{/foreach}
								</div>
							</li>
							<li></li>
							<li></li>
						</ul>
					</div>
					<div class="hr"></div>
				</div>
				<div class="linkInfo">
					<div class="step-tit">
						<h5>发票信息</h5>
					</div>
					<div class="step-cont">
						<span>普通发票（电子）</span>
						<span>个人</span>
						<span>明细</span>
					</div>
				</div>
				<div class="cardInfo">
					<div class="step-tit">
						<h5>使用优惠/抵用</h5>
					</div>
				</div>
			</div>
		</div>
		<div class="order-summary">
			<div class="static fr">
				<div class="list">
					<span><i class="number">{$cart_number}</i>件商品，总商品金额</span>
					<em class="allprice">¥{$goods_price}</em>
				</div>
				<div class="list">
					<span>返现：</span>
					<em class="money">0.00</em>
				</div>
				<div class="list">
					<span>运费：</span>
					<em class="transport">0.00</em>
				</div>
			</div>
		</div>
		<div class="clearfix trade">
			<div class="fc-price">应付金额:　<span class="price">¥{$goods_price}</span></div>
			<div class="fc-receiverInfo "></div>
		</div>
		<div class="submit">
			<a class="sui-btn btn-danger duyoude btn-xlarge" href="javascript:void(0)">提交订单</a>
		</div>
	</div>
	<form action="{:url('index/Order/btngoods')}" method="post" display="none" class="form_but">
		<input type="hidden" name="cart_ids" value="{$Think.get.cart_ids}">
		<input type="hidden" name="cart_address" value="">
		<input type="hidden" name="pay_type">
	</form>
	
	<script>
		$(function(){

			// 提交订单
			$(".duyoude").click(function(){

				if($(".fc-receiverInfo").html() == ""){
					alert("请选择收件人信息");
					return;
				}

				var addres_id = $(".name.selected").closest('li').attr('addres_ids');
				var pay_type = $(".payType .selected").attr('pay_type');

				$("input[name=cart_address]").val(addres_id);
				$("input[name=pay_type]").val(pay_type);

				$(".form_but").submit();
			})

			// 收件人添加信息
			$(".name").click(function(){

				var consignee_name = $(".consignee_name").html();
				var consignee_address = $(".consignee_address").html();
				var consignee_phone = $(".consignee_phone").html();

				$(".fc-receiverInfo").html("寄送至：" + consignee_address + " 收货人：" + consignee_name + " 手机号：" + consignee_phone);
			});

			// 添加地址
			$(".btn-primary").click(function() {

				var flag = true;

				if($("input[name=consignee]").val() == "") {
					$("input[name=consignee]").parent().find('.error').html("收件人不可以为空亲");
					flag = false;
				}else{
					$("input[name=consignee]").parent().find('.error').html("");
				}

				if($("input[name=address]").val() == "") {
					$("input[name=address]").parent().find('.error').html("地址不可以为空亲");
					flag = false;
				}else{
					$("input[name=address]").parent().find('.error').html("");
				}

				if($("input[name=phone]").val() == "") {
					$("input[name=phone]").parent().find('.error').html("手机号不可以为空亲");
					flag = false;

				}else if(!/^1[3-9]\d{9}$/.test($("input[name=phone]").val())){

					$("input[name=phone]").parent().find('.error').html("手机号格式不正确");
					flag = false;

				}else{
					$("input[name=phone]").parent().find('.error').html("");
				}

				if(flag){
					$(".sui-form").submit();
				}
			})
		})
	</script>